package com.meng.ioc_demo;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.meng.ioclibrary.BindView;
import com.meng.ioclibrary.OnClick;
import com.meng.ioclibrary.ViewUtils;


/**
 * Created by Administrator on 2017/5/3.
 */

public class MyFragment extends Fragment{
    @BindView(R.id.button)
    Button button;
    @BindView(R.id.tv)
    TextView tv;
    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_my,null);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        ViewUtils.inject(getView(),this);
        tv.setText("Fragment");
    }
    @OnClick(R.id.button)
    public void onClick(View view){
        Toast.makeText(getActivity(), "Fragment中的Button", Toast.LENGTH_SHORT).show();
    }
}
